{{include file="header.html"}}
{{assign var="sex" value='sex'|C}}
<body>
	<div class="container_person" id="printContainer">
	<div>
		
	</div>
		<p>项目详情表</p>
		<table border="1" class="item_detail">
			<tr>
				<td>项目名称</td>
				<td colspan="6">{{$result.team_name}}</td>
			</tr>
			<tr>
				<td>团队名称</td>
				<td colspan="6">{{$result.params.team}}</td>
			</tr>
			<tr class="h_company">
				<td rowspan="11">团队成员<br>(不超10人)</td>
				<td>姓名</td>
				<td>性别</td>
				<td>手机</td>
				<td>院系</td>
				<td>班级</td>
			</tr>
			{{if !$result.params.company}}
			<tr class="no_company">
				<td colspan="6">无</td>
			</tr>
			{{else}}
			{{foreach from=$result.params.company item=val}}
			<tr class="company">
				<td>{{$val.name_c}}</td>
				<td>{{$val.sex_c}}</td>
				<td>{{$val.phone_c}}</td>
				<td>{{$val.xy_n}}</td>
				<td>{{$val.grade_n}}</td>
			</tr>
			{{/foreach}}
			{{/if}}
			<tr class="h_teacher">
				<td rowspan="2">指导老师<br>(1人)</td>
				<td>姓名</td>
				<td>性别</td>
				<td>院系</td>
				<td>职称</td>
				<td>研究方向</td>
			</tr>
			{{if !$result.params.company}}
			<tr class="no_teacher">
				<td colspan="5">无</td>
			</tr>
			{{else}}
			<tr  class="teacher">
				<td>{{$result.params.teacher.name_t}}</td>
				<td>{{$result.params.teacher.sex_te}}</td>
				<td>{{$result.params.teacher.xy_name_t}}</td>
				<td>{{$result.params.teacher.job_t}}</td>
				<td>{{$result.params.teacher.process_te}}</td>
			</tr>
			{{/if}}
			<tr>
				<td style="width:80px;">项目意义</td>
				<td colspan="6" class="p">{{$result.params.team_mean}}</td>
			</tr>
			<tr>
				<td style="width:80px;">项目内容</td>
				<td colspan="6" class="p">{{$result.params.team_content}}</td>
			</tr>
		</table>
	</div>
	<div class="btn_p">
		<a href="javascript:();" class="print back" onclick="check({{$result.id}})">同意</a>
		<button class="print" onclick="printpage()">打印</button>
		<div class="clear"></div>
	</div>
</body>
<script>
	$(function(){
		var num = $(".item_detail").find(".company").size();
		var need = 10-num;

		if(num<1){
			$(".no_company").show();
			need=need-1;
		}
		for(var i = 0 ;i<need;i++){
			$(".h_company").after("<tr></tr>");
		}

		var num_t =  $(".item_detail").find(".teacher").size();
		if(num_t<1){
			$(".no_teacher").show();
		}

	})
	jQuery.fn.extend({
	    autoHeight: function(){
	        return this.each(function(e){
	            var $this = jQuery(this);
	            if( !$this.attr('_initAdjustHeight') ){
	                $this.attr('_initAdjustHeight', $this.outerHeight());
	            }
	            _adjustH(this).on('input', function(){
	                _adjustH(this);
	            });
	            
	        });
	        /**
	         * 重置高度 
	         * @param {Object} elem
	         */
	        function _adjustH(elem){
	            var $obj = jQuery(elem);
	            test(elem);
	            return $obj.css({height: $obj.attr('_initAdjustHeight'), 'overflow-y': 'hidden'})
	                    .height( elem.scrollHeight );
	        }
	    }
	});
	// 使用
	$(function(){
	    $('textarea').autoHeight();
		$('.col-sm-9').each(function(a,b) {
			var col=$(this);
			var height=col.css('height');
			col.siblings('div.col-sm-1.br.chushi').css('height',height);
		});
				
    });
    function test(elem){
    	var $obj = jQuery(elem);
    	var parent=$obj.parent();
    	var height=elem.scrollHeight+32;
    	parent.siblings('div.col-sm-1.br.chushi').css({height:height});
    	parent.siblings('div.col-sm-1.br.chushi').children('span').css({height:height});
    }

 
    function printpage(){
    	$("#printContainer").printArea();
  	}

  	//审核
  	function check(id){
  		if(confirm("您确定同意成为该项目的指导老师？")){
  			$.post('{{"index.php?app=Project&act=check"|URL}}',{check:id},function(result){
		        if(result.statusCode=='200'){
					ui.success(result.message);
					document.cookie="time_t="+Date.parse(new Date());
					setTimeout(function(){
						var url = "{{$smarty.const.__PROJECT__}}Project/teacher"; 
						document.location.href = url;//登录后跳转页面
					},1000);
		        }else if(result.statusCode=='300'){
		        	ui.error(result.message);
		        }	
		    },'json');
  		}
  	}
    </script>
</html>